package com.gzbsoft.sc.modules.sys.entity;
import io.ebean.annotation.DbComment;
import io.ebean.annotation.DocEmbedded;
import io.ebean.annotation.DocStore;
import lombok.*;

import javax.persistence.*;
import java.util.List;
@DocStore
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "jx_good")
@DbComment("商品基本表")
public class JxGood extends BaseEntity {
    @OneToOne
    @JoinColumn(name = "jx_shop_id")
    @DocEmbedded(doc = "id, name,type,shopTemplate(id,link)")
    private JxShop shop;
    @DbComment("商品标题")
    private String title;
    @DbComment("商品分类")
    private String type;
    @DbComment("快递费")
    @Column(nullable = true)
    private String express;
    @DbComment("销量")
    private String saleCount;
    @DbComment("产地")
    private String origin;
    @DbComment("宣传图")
    private String imgs;
    @DbComment("状态, 1: 正常, 2: 待审核, 3: 审核未通过")
    private Integer status;
    @DbComment("是否诚信商品")
    private String sign;
    @DbComment("品牌")
    private String brand;
    @DocEmbedded
    @OneToMany
    private List<JxGoodSku> goodSkuList;
    @Override
    public String toString() {
        return "JxGood{" +
                "shop=" + shop +
                ", title='" + title + '\'' +
                ", type='" + type + '\'' +
                ", express='" + express + '\'' +
                ", saleCount='" + saleCount + '\'' +
                ", origin='" + origin + '\'' +
                ", status=" + status +
                ", sign='" + sign + '\'' +
                ", brand='" + brand + '\'' +
                ", goodSkuList=" + goodSkuList +
                ", id=" + id +
                '}';
    }
}
